textbuffer: emit notify signal for the "text" property
authorSébastien Wilmet <swilmet@gnome.org>
Sun, 20 Jul 2014 13:44:12 +0000 (15:44 +0200)
committerSébastien Wilmet <swilmet@gnome.org>
Tue, 29 Jul 2014 13:21:23 +0000 (15:21 +0200)
Although there is the "changed" signal, it is more correct to notify the
"text" property too. It can be useful for a small text view, where the
text is saved e.g. to gsettings with a binding to the text property.

The "text" property includes only the text, not child widgets or images,
so the notify signal is sent too many times (also for child widgets and
images), but it's not a big problem.

https://bugzilla.gnome.org/show_bug.cgi?id=624791

gtk/gtktextbuffer.c

index 0af7cf7e904d32da40721ed03277b0ad4dd2e500..672353ceb7952d36911e0b9b85b151b1a58100ee 100644 (file)
@@ -878,8 +878,6 @@ gtk_text_buffer_set_text (GtkTextBuffer *buffer,
       gtk_text_buffer_get_iter_at_offset (buffer, &start, 0);
       gtk_text_buffer_insert (buffer, &start, text, len);
     }
-  
-  g_object_notify (G_OBJECT (buffer), "text");
 }
 
  
@@ -2545,6 +2543,8 @@ static void
 gtk_text_buffer_real_changed (GtkTextBuffer *buffer)
 {
   gtk_text_buffer_set_modified (buffer, TRUE);
+
+  g_object_notify (G_OBJECT (buffer), "text");
 }
 
 static void